<template>
    <div>
        <main class="mx-auto max-w-7xl flex-1 px-4 py-8 sm:px-6 lg:px-8">
            <div class="rounded-lg bg-white p-6 shadow">
                <h2 class="m-12 text-2xl font-bold text-gray-800 text-center">欢迎使用FilmHub影片管理系统</h2>

                <!-- 统计卡片 -->
                <div class="mb-8 grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4">
                    <div class="rounded-lg bg-blue-50 p-6">
                        <h3 class="mb-1 text-sm font-medium text-blue-800">用户总数</h3>
                        <p class="text-3xl font-bold text-blue-900">{{ usersCount }}</p>
                        <!-- <p class="mt-1 text-xs text-blue-600">较上月 +12%</p> -->
                    </div>
                    <!-- <div class="rounded-lg bg-green-50 p-6">
                        <h3 class="mb-1 text-sm font-medium text-green-800">订单数量</h3>
                        <p class="text-3xl font-bold text-green-900">356</p>
                        <p class="mt-1 text-xs text-green-600">今日新增 24</p>
                    </div> -->
                    <div class="rounded-lg bg-yellow-50 p-6">
                        <h3 class="mb-1 text-sm font-medium text-yellow-800">影片数量</h3>
                        <p class="text-3xl font-bold text-yellow-900">{{ listCount }}</p>
                        <!-- <p class="mt-1 text-xs text-yellow-600">需尽快处理</p> -->
                    </div>
                    <!-- <div class="rounded-lg bg-purple-50 p-6">
                        <h3 class="mb-1 text-sm font-medium text-purple-800">系统状态</h3>
                        <p class="text-3xl font-bold text-purple-900">正常</p>
                        <p class="mt-1 text-xs text-purple-600">运行中</p> -->
                </div>
            </div>

            <!-- 快捷操作 -->
            <div class="mb-8">
                <h3 class="mb-4 text-lg font-medium text-gray-900">快捷操作</h3>
                <div class="grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5">
                    <a href="#/index/user" class="rounded-lg bg-gray-100 p-4 text-center transition hover:bg-gray-200">
                        <div
                            class="mx-auto mb-2 flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 text-blue-600"
                        >
                            <svg
                                xmlns="http://www.w3.org/2000/svg"
                                class="h-6 w-6"
                                fill="none"
                                viewBox="0 0 24 24"
                                stroke="currentColor"
                            >
                                <path
                                    stroke-linecap="round"
                                    stroke-linejoin="round"
                                    stroke-width="2"
                                    d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"
                                />
                            </svg>
                        </div>
                        <span class="text-sm font-medium text-gray-700">用户管理</span>
                    </a>
                    <a href="#/index/list" class="rounded-lg bg-gray-100 p-4 text-center transition hover:bg-gray-200">
                        <div
                            class="mx-auto mb-2 flex h-10 w-10 items-center justify-center rounded-full bg-green-100 text-green-600"
                        >
                            <svg
                                xmlns="http://www.w3.org/2000/svg"
                                class="h-6 w-6"
                                fill="none"
                                viewBox="0 0 24 24"
                                stroke="currentColor"
                            >
                                <path
                                    stroke-linecap="round"
                                    stroke-linejoin="round"
                                    stroke-width="2"
                                    d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"
                                />
                            </svg>
                        </div>
                        <span class="text-sm font-medium text-gray-700">电影管理</span>
                    </a>
                    <!-- <a href="#" class="rounded-lg bg-gray-100 p-4 text-center transition hover:bg-gray-200">
                        <div
                            class="mx-auto mb-2 flex h-10 w-10 items-center justify-center rounded-full bg-yellow-100 text-yellow-600"
                        >
                            <svg
                                xmlns="http://www.w3.org/2000/svg"
                                class="h-6 w-6"
                                fill="none"
                                viewBox="0 0 24 24"
                                stroke="currentColor"
                            >
                                <path
                                    stroke-linecap="round"
                                    stroke-linejoin="round"
                                    stroke-width="2"
                                    d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"
                                />
                            </svg>
                        </div>
                        <span class="text-sm font-medium text-gray-700">内容管理</span>
                    </a>
                    <a href="#" class="rounded-lg bg-gray-100 p-4 text-center transition hover:bg-gray-200">
                        <div
                            class="mx-auto mb-2 flex h-10 w-10 items-center justify-center rounded-full bg-purple-100 text-purple-600"
                        >
                            <svg
                                xmlns="http://www.w3.org/2000/svg"
                                class="h-6 w-6"
                                fill="none"
                                viewBox="0 0 24 24"
                                stroke="currentColor"
                            >
                                <path
                                    stroke-linecap="round"
                                    stroke-linejoin="round"
                                    stroke-width="2"
                                    d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
                                />
                                <path
                                    stroke-linecap="round"
                                    stroke-linejoin="round"
                                    stroke-width="2"
                                    d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
                                />
                            </svg>
                        </div>
                        <span class="text-sm font-medium text-gray-700">系统设置</span>
                    </a>
                    <a href="#" class="rounded-lg bg-gray-100 p-4 text-center transition hover:bg-gray-200">
                        <div
                            class="mx-auto mb-2 flex h-10 w-10 items-center justify-center rounded-full bg-red-100 text-red-600"
                        >
                            <svg
                                xmlns="http://www.w3.org/2000/svg"
                                class="h-6 w-6"
                                fill="none"
                                viewBox="0 0 24 24"
                                stroke="currentColor"
                            >
                                <path
                                    stroke-linecap="round"
                                    stroke-linejoin="round"
                                    stroke-width="2"
                                    d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
                                />
                            </svg>
                        </div>
                        <span class="text-sm font-medium text-gray-700">最近活动</span>
                    </a> -->
                </div>
            </div>

            <!-- 最近动态 -->
            <!-- <div>
                <h3 class="mb-4 text-lg font-medium text-gray-900">最近动态</h3>
                <div class="rounded-lg bg-gray-50 p-4">
                    <ul class="divide-y divide-gray-200">
                        <li class="py-3">
                            <div class="flex items-center">
                                <div class="mr-3 rounded-full bg-blue-100 p-2">
                                    <svg
                                        xmlns="http://www.w3.org/2000/svg"
                                        class="h-5 w-5 text-blue-600"
                                        fill="none"
                                        viewBox="0 0 24 24"
                                        stroke="currentColor"
                                    >
                                        <path
                                            stroke-linecap="round"
                                            stroke-linejoin="round"
                                            stroke-width="2"
                                            d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"
                                        />
                                    </svg>
                                </div>
                                <div>
                                    <p class="text-sm font-medium text-gray-900">新用户注册</p>
                                    <p class="text-xs text-gray-500">5分钟前 - 用户"张三"注册了账号</p>
                                </div>
                            </div>
                        </li>
                        <li class="py-3">
                            <div class="flex items-center">
                                <div class="mr-3 rounded-full bg-green-100 p-2">
                                    <svg
                                        xmlns="http://www.w3.org/2000/svg"
                                        class="h-5 w-5 text-green-600"
                                        fill="none"
                                        viewBox="0 0 24 24"
                                        stroke="currentColor"
                                    >
                                        <path
                                            stroke-linecap="round"
                                            stroke-linejoin="round"
                                            stroke-width="2"
                                            d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"
                                        />
                                    </svg>
                                </div>
                                <div>
                                    <p class="text-sm font-medium text-gray-900">新订单创建</p>
                                    <p class="text-xs text-gray-500">1小时前 - 订单 #12345 已创建</p>
                                </div>
                            </div>
                        </li>
                        <li class="py-3">
                            <div class="flex items-center">
                                <div class="mr-3 rounded-full bg-yellow-100 p-2">
                                    <svg
                                        xmlns="http://www.w3.org/2000/svg"
                                        class="h-5 w-5 text-yellow-600"
                                        fill="none"
                                        viewBox="0 0 24 24"
                                        stroke="currentColor"
                                    >
                                        <path
                                            stroke-linecap="round"
                                            stroke-linejoin="round"
                                            stroke-width="2"
                                            d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"
                                        />
                                    </svg>
                                </div>
                                <div>
                                    <p class="text-sm font-medium text-gray-900">内容更新</p>
                                    <p class="text-xs text-gray-500">3小时前 - 首页banner已更新</p>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div> -->
        </main>
    </div>
</template>

<script setup lang="ts">
import { getAllListAPI } from "@/api/list";
import { getAllUsersAPI } from "@/api/user";

const usersCount = ref(0);
const listCount = ref(0);

const getData = async () => {
    const res = await getAllUsersAPI();
    usersCount.value = res.length;
    const res2 = await getAllListAPI();
    listCount.value = res2.length;
};

onMounted(() => {
    getData();
});
</script>

<style>
/* 可以添加自定义样式 */
</style>
